package com.idol.controller;

import com.github.pagehelper.PageInfo;
import com.idol.pojo.Article;
import com.idol.service.IArticleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * @author Supreme_Sir
 * @version 1.0
 * @className ArticleController
 * @description
 * @date 2020/11/8 21:05
 **/
@Controller
@RequestMapping("article")
public class ArticleController {
    @Autowired
    private IArticleService articleService;

    @RequestMapping("page/{pageNum}/{pageSize}")
    public String queryPage(Model model, @PathVariable(name = "pageNum") Integer pageNum, @PathVariable(name = "pageSize") Integer pageSize) {
        PageInfo<Article> pageInfo = articleService.selectByPage(pageNum, pageSize);
        model.addAttribute("pageInfo", pageInfo);
        return "index";
    }
}
